'''
@Company: TWL
@Author: xue jian
@Email: xuejian@kanzhun.com
@Date: 2020-04-09 17:54:53
'''
# -*- coding: UTF-8 -*-
from compare_train import CompareTrain
from deepFM_success_simple import get_deepfm_success_simple
from xgboost_train import XgboostTrain
import time, random


f_path = "/data2/training_data/boss_rank/"
# the pred dates
dates = []
dates.extend(['2020-04-08'])

features_0309 = ['boss_position', 'boss_city', 'boss_cmp_level',\
    'boss_title_type', 'boss_comp_scale', 'job_workyears', 'job_degree', \
    'jh', 'jl', 'job_det_times_7d', 'job_det_times_2d', 'job_addf_success_times_7d',\
    'job_addf_times_7d', 'job_addfchat_times_7d', 'job_success_times_2d', \
    'job_success_times_7d', 'boss_addfchat_times_2d', 'boss_addf_times_2d', \
    'boss_addf_success_times_2d', 'boss_det_times_2d', 'boss_addf_pchat_times_2d', \
    'job_plist_times_14d', 'job_pdet_times_2d', 'job_paddf_times_7d', 'job_psuccess_times_7d', \
    'job_pdet_times_14d', 'boss_paddf_success_times_2d', 'boss_pdet_times_2d', \
    'job_paddf_times_14d', 'job_pdet_times_7d', 'boss_paddfchat_times_2d', 'geek_position', \
    'geek_city', 'geek_apply_status', 'geek_gender', 'eh', 'el', 'geek_degree_new', \
    'geek_school_level', 'geek_degree', 'geek_major', 'geek_rev_work_year', 'geek_cmp_level', \
    'geek_workyears', 'geek_det_times_7d', 'geek_success_times_7d', 'geek_success_times_2d', \
    'geek_addfchat_times_2d', 'geek_addfchat_times_7d', 'geek_addf_times_7d', \
    'geek_paddf_success_times_7d', 'geek_plist_times_14d', 'geek_pdet_times_2d', \
    'geek_paddf_times_14d', 'geek_paddf_times_7d', 'geek_paddfchat_times_7d', \
    'geek_paddf_times_2d', 'geek_pdet_times_7d', 'geek_paddf_pchat_times_7d', \
    'geek_paddf_pchat_times_2d', 'geek_min_active_tdiff', 'geek_min_chat_tdiff', \
    'exp_register_tdiff', 'exp_min_active_tdiff', 'exp_det_num_24h', 'geek_complete_tdiff', \
    'boss_view_geek_14d', 'boss_det_geek_14d', 'boss_pview_geek_14d', 'boss_pdet_geek_14d', \
    'b2g_airbnb_emb_gof_int', 'b2g_w2v_orig_gof', 'b2g_w2v_pref_gof']

class DeepFMXgboostCompare(CompareTrain):

    def make_label(self, l):
        if l == 'success':
            return 1
        return 0
    def get_train_object(self):
        xgboost_train = XgboostTrain(self.file_path, self.dates, self.watch_num, self.batch_size, \
            self.thread_num, self.read_data_parallel, features_0309, \
            "/data1/xuejian/sync/offline_train/xgboost/output/2020-04-08/model/all_cluster/gbdt.bin")
        return [xgboost_train]


if __name__ == '__main__':
#    com_train = DeepFMXgboostCompare(f_path, dates, 100000, 4000, 24, 0, False)
    com_train = DeepFMXgboostCompare(f_path, dates, 200000, 4000, 24, 0, False)
#    com_train = DeepFMXgboostCompare(f_path, dates, 300000, 4000, 24, 0, False)
    before = time.time()
    com_train.train()
    after = time.time()
    print("time = ", after - before)